package com.diploma.project.aiqiyi.exception;

import com.diploma.project.aiqiyi.common.enums.CommonOutputEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;


@Data
@EqualsAndHashCode(callSuper = true)
public class BaseException extends RuntimeException {

    private static final long serialVersionUID = -5450301440861289229L;

    private Integer code;
    private String msg;

    public BaseException(CommonOutputEnum outputEnum, String... replaceMsg) {
        super(outputEnum.getMsg());
        this.code = outputEnum.getCode();
        this.msg = String.format(outputEnum.getMsg(), replaceMsg);
    }

    public BaseException(String message) {
        super(message);
    }

}
